package com.xxh.blog.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xxh.blog.entity.UserMessage;
import com.xxh.blog.entity.vo.UserMessageVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

@Component("UserMessageDao")
public interface UserMessageDao extends BaseMapper<UserMessage> {
    int deleteByPrimaryKey(Long id);

    int insert(UserMessage record);

    int insertSelective(UserMessage record);

    UserMessage selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(UserMessage record);

    int updateByPrimaryKey(UserMessage record);

    IPage<UserMessageVo> paging(Page page,@Param(Constants.WRAPPER) QueryWrapper<UserMessageVo> wrapper);

    @Update("update user_message set status = 1 ")
    void upDateToRead(@Param(Constants.WRAPPER) QueryWrapper<UserMessage>wrapper);
}